<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>我的设备</title>
    <link rel="stylesheet" href="mobile/layui/css/layui.mobile.css">
    <link rel="stylesheet" href="mobile/layui/css/layui.css">
    <link rel="stylesheet" href="mobile/css/yj_css.css">
</head>
<body>

<header class="yj-header">
    <a class="yj-header-return layui-icon"></a>
    <span>我的订单</span>
    <a class="yj-header-meau"></a>
</header>
<footer class="yj-footer">
    <a class="yj-footer-item" href="lessorindex">
        <span class="yj-footer-icon"><img src="mobile/images/home1.png"></span>
        <p class="yj-footer-title">首页</p>
    </a>
    <a class="yj-footer-item yj-footer-middle" href="lessorinfo">
        <span class="yj-footer-icon"><img src="mobile/images/user1.png"></span>
        <p class="yj-footer-title">会员中心</p>
    </a>
    <a class="yj-footer-item">
        <span class="yj-footer-icon"><img src="mobile/images/printer2.png"></span>
        <p class="yj-footer-title yj-color-main">我的订单</p>
    </a>
</footer>
<div class="yj-content yj-mar-footer">
    <div class="yj-goods-attr-title yj-fixedTop-main">
        <a class="yj-active yj-tab1" onclick="tab('yj-goods-attr',1)"><span>全部订单</span></a>
        <a class="yj-tab2" onclick="tab('yj-goods-attr',2)"><span>进行中</span></a>
        <a class="yj-tab3" onclick="tab('yj-goods-attr',3)"><span>已完成</span></a>
    </div>
    <div class="yj-goods-detail-box">
        <div class="yj-goods-attr1" style="margin-top: 0px;" id="tab1">
            <ul class="yj-order yj-pad-t" id="orderAll">
            </ul>
        </div>
        <div class="yj-goods-attr2 yj-none" id="tab2">
            <ul class="yj-order yj-pad-t" id="orderIng">
            </ul>
        </div>
        <div class="yj-goods-attr3 yj-none" id="tab3">
            <ul class="yj-order yj-pad-t" id="orderFinished">
            </ul>
        </div>
    </div>

</div>
<script src="mobile/js/jquery.min.js"></script>
<script src="mobile/layui/layui.all.js"></script>
<script src="mobile/js/yj_js.js"></script>
<script>
    $(document).ready(function () {
        $.ajax({
            url: "orderForm/findall",
            success: function (data) {
                var order_all = $("#orderAll");
                var order_finished = $("#orderFinished");
                var order_ing = $("#orderIng");
                order_all.empty();
                order_finished.empty();
                order_ing.empty();
                for (var i = 0; i < data.result.length; i++) {
                    var order = data.result[i];
                    var operate = "<p class=\"yj-list-item yj-pad-lr yj-border-t\"><span class=\"yj-right\"><a class=\"yj-btn yj-btn-sm\" href=\"/sharepark/opiniontotenant.html?id=" + order.oId + "\">投诉</a><a class=\"yj-btn yj-btn-sm\" href=\"/sharepark/tenantcomment.html?id=" + order.oId + "\">评论</a></span></p>";
                    var orderinfo = "<li class=\"yj-order-item yj-bgfff yj-mar-t yj-pad-lr-big\">" +
                        "<p class=\"yj-list-item\"><img class=\"yj-list-item-icon\" src=\"mobile/images/printer1.png\">" + order.oNumber + "<span class=\"yj-color-red yj-right\">" + order.oStatus + "</span></p>" +
                        "<a class=\"yj-order-basicinfo yj-pad-tb-big\">" +
                        "<span class=\"yj-goods-thumbnail\"><img src=\"/sharepark/" + order.carPark.cPic + "\"></span>" +
                        "<div class=\"yj-confirm-goods-textinfo\">" +
                        "<div class=\"yj-goods-price yj-pad-t yj-clearfix\">" +
                        "<p class=\"yj-color-gray yj-mar-tb\">订单开始时间：" + order.oTime + "</p>" +
                        "<p class=\"yj-color-gray yj-mar-tb\">订单结束时间：" + order.oEndtime + "</p></div></div></a>"
                    if (order.oStatus === "已租"){
                        orderinfo = orderinfo + "</li>"
                        order_ing.append(orderinfo);
                    } else {
                        orderinfo = orderinfo + operate + "</li>"
                        order_finished.append(orderinfo);
                    }
                    order_all.append(orderinfo);
                }
            }
        })
    })
</script>
</body>
</html>